<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <!--头部固定引用-->
    <meta charset="utf-8">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/icon-font.css"/><!--图标-->
    <!--固定引用结束,自定义引用添加在下面-->
    <title>编辑个人资料</title>
    <style>
        .edit-personal-wrap {
            margin-top: 0.16rem;
        }

        .edit-personal-area {
            padding: 0.14rem 0.32rem 0 0.32rem;
        }

        .edit-personal-item {
            padding: 0.36rem 0 0.34rem 0;
            border-bottom: 1px solid #F2F2F2;
        }

        .edit-personal-left {
            color: #222222;
        }

        .edit-personal-info {
            word-break: break-all;
            width: 4.5rem;
            text-align: right;
        }

        .edit-personal-input {
            color: #222222;
            /*height: 0.3rem;*/
        }

        .edit-personal-img {
            height: 0.88rem;
            width: 0.88rem;
            border-radius: 5rem
        }

        .edit-personal-return {
            color: rgba(153, 153, 153, 0.6);
        }

        .edit-personal-width{
            width:1.5rem
        }


    </style>
</head>
<body>

<!--定义整个页面格局-->
<div class="flex-column h-100-p ff400">

    <!-- 导航栏&标题栏 -->
    <div class="placeholder-top">
        <!--状态栏-->
        <div class="bg-main status-bar "></div>
        <!--导航栏-->
        <div class="bg-main nav-bar flex-row justify-content-between c-white align-items-center">
            <div class="left-bar" onclick="clickBack()">
                <span class="iconfont iconfanhui1 fs16"></span>

            </div>
            <div class="center-bar  ff500 line1  ta-center">个人资料</div>
            <div class="right-bar">

            </div>
        </div>
    </div>

    <!--编辑区-->
    <div class="edit-personal-wrap flex-column scoll-y bg-white">
        <div class="flex-column edit-personal-area">
            <!--头像-->
            <div class="edit-personal-item flex-row justify-content-between align-items-center fs15">
                <div class="edit-personal-left fs15">头像</div>
                <div class="edit-personal-right flex-row align-items-center">
                    <img class="edit-personal-img" src="../../images/user/user-comment.png"/>
                    <!--<span class="edit-personal-return iconfont iconfanhui fs9 ml15"></span>-->
                </div>
            </div>

            <!--用户名-->
            <div class="edit-personal-item flex-row justify-content-between align-items-center fs15">
                <div>
                    <div class="flex-row edit-personal-left fs15 align-items-center">
                        <div class="edit-personal-width">用户名</div>
                        <div class="edit-personal-info ml20"></div>
                    </div>
                </div>
                <div class="edit-personal-right flex-row align-items-center"></div>
            </div>

            <!--姓名-->
            <div class="edit-personal-item flex-row justify-content-between align-items-center fs15" onclick="jumpEdit(0)">
                <div>
                    <div class="flex-row edit-personal-left align-items-center">
                        <div class="edit-personal-width">姓名</div>
                        <div class="edit-personal-info ml20">
                            <div class="fs15 edit-personal-input"></div>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="edit-personal-right flex-row align-items-center">
                        <span class="edit-personal-return iconfont iconfanhui fs9 ml15"></span>
                    </div>
                </div>
            </div>

            <!--邮箱-->
            <div class="edit-personal-item flex-row justify-content-between align-items-center fs15" onclick="jumpEdit(1)">
                <div>
                    <div class="flex-row edit-personal-left align-items-center">
                        <div class="edit-personal-width">邮箱</div>
                        <div class="edit-personal-info ml20">
                            <div class="fs15 edit-personal-input"></div>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="edit-personal-right flex-row align-items-center">
                        <span class="edit-personal-return iconfont iconfanhui fs9 ml15"></span>
                    </div>
                </div>
            </div>

            <!--座机-->
            <div class="edit-personal-item flex-row justify-content-between align-items-center fs15" onclick="jumpEdit(2)">
                <div>
                    <div class="flex-row edit-personal-left align-items-center">
                        <div class="edit-personal-width">座机</div>
                        <div class="edit-personal-info ml20">
                            <div class="fs15 edit-personal-input"></div>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="edit-personal-right flex-row align-items-center">
                        <span class="edit-personal-return iconfont iconfanhui fs9 ml15"></span>
                    </div>
                </div>
            </div>

            <!--所在城市-->
            <div class="edit-personal-item flex-row justify-content-between align-items-center fs15" onclick="jumpEdit(3)">
                <div>
                    <div class="flex-row edit-personal-left align-items-center">
                        <div class="edit-personal-width">所在城市</div>
                        <div class="edit-personal-info ml20">
                            <div class="fs15 edit-personal-input"></div>
                        </div>
                    </div>
                </div>
                <div>
                    <div class="edit-personal-right flex-row align-items-center">
                        <span class="edit-personal-return iconfont iconfanhui fs9 ml15"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>
</body>
<script src="../../js/dict.js"></script>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/checkJsBridge.js"></script>
<script src="../../js/utils.js"></script>
<script src="../../js/api.js"></script>
<!--固定引用结束-->
<script>
  let pm = {
    headSculpture: '', // 头像
    realName: '', //姓名
    email: '', //  邮箱
    phone: '', //座机
    liveAddress: '' // 所在城市
  }

  /*固定页面初始化方法，用于替代$(function(){}),param为url参数，Object类型*/
  function initPage(params) {
    Utils.sbhAdaptive()
    getUserInfo()

  }

  function startPage(params) {
    getUserInfo()
  }

  function reLoadPage() {
    getUserInfo()
  }

  // 获取用户信息
  function getUserInfo() {
    Server.editPersonal.getAppUserInfo({}).then(function (data) {
      if (data.userInfo) {
        $('.edit-personal-info').eq(0).html(data.userInfo.userName)
        pm.realName = Utils.dealUndefined(data.userInfo.realName)
        $('.edit-personal-input').eq(0).html(pm.realName) // 姓名

        pm.email = Utils.dealUndefined(data.userInfo.email) // 邮箱
        $('.edit-personal-input').eq(1).html(pm.email) // 邮箱

      }
      if (data.userExtInfo) {
        if (data.userExtInfo.headSculpture) {
          // $('.edit-personal-img').attr('src',data.userExtInfo.headSculpture)
        }
        pm.phone = Utils.dealUndefined(data.userExtInfo.phone) // 座机
        $('.edit-personal-input').eq(2).html(pm.phone) // 座机

        pm.liveAddress = Utils.dealUndefined(data.userExtInfo.liveAddress) // 所在地址
        $('.edit-personal-input').eq(3).html(pm.liveAddress) // 座机
      }

    }).catch((err) => {
      // 获取用户信息失败
      jsBridge.log(err)
    })
  }

  // 跳转个人编辑页面
  function jumpEdit(num) {
    let val
    if (0 === num) {
      val = $('.edit-personal-input').eq(0).html()
    } else if (1 === num) {
      val = $('.edit-personal-input').eq(1).html()
    } else if (2 === num) {
      val = $('.edit-personal-input').eq(2).html()
    } else if (3 === num) {
      val = $('.edit-personal-input').eq(3).html()
    }
    jsBridge.openWindow('html/user/edit.html?type=' + num + '&val=' + val, {}, {noBar: false})
  }


</script>
</html>
